from django.db import models


# Create your models here.


class UserActionLogManager(models.Manager):

    def format_log(self, ):
        pass


class UserActionLog(models.Model):
    id = models.BigAutoField(
        primary_key=True
    )
    user = models.ForeignKey(
        'user.User',
        on_delete=models.SET_NULL,
        null=True,
        verbose_name="用户"
    )
    devices = models.ForeignKey(
        'devices.Devices',
        on_delete=models.SET_NULL,
        null=True,
        verbose_name="设备"
    )
    action_time = models.DateTimeField(
        auto_now=True,
       
        verbose_name="日志事件"
    )
    description = models.CharField(
        max_length=255,
        verbose_name="日志详情",
        null=True,
        default=""
    )
    error_stack = models.TextField(
        verbose_name="错误堆栈信息",
        null=True,
        default=""
    )

    class Meta:
        db_table = 'logs'
        permissions = (
            ('logs_get', '查询日志'),
        )
        default_permissions = ()
